<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../back-common.jsp"%>
<%@ include file="/WEB-INF/pages/common/taglib.jsp"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
   <table class="${tableclass}" style="width: 100%">
	   <tr><th>
	          <strong class="am-text-primary am-text-lg">首页</strong> /  项目管理
	    	</th>
	    </tr>
	</table>  		    

<div style="margin-left: 0.5rem">
    <div class="seller_list_title">
        <ul class="seller_title_ul am-tabs-nav am-nav am-nav-tabs">
            <li class="am-active"><i></i><a href="<ls:url address="/admin/project/query"/>">正在进行的项目</a></li>
            <li><i></i><a href="<ls:url address="/admin/project/queryFinish"/>">已经完成的项目</a></li>
        </ul>
    </div>
</div>

    <form action="<ls:url address='/admin/project/query'/>" id="form1" method="post">
        <table class="${tableclass}" style="width: 100%">
		    <tbody><tr><td>
		    	    <div align="left" style="padding: 3px;min-width: 400px">
				       	    <input type="hidden" id="curPageNO" name="curPageNO" value="${curPageNO}" />
				            &nbsp;项目名字&nbsp;
				            <input type="text" name="projectName" maxlength="50" value="${projectQueryDto.projectName}" />
				            &nbsp;项目经理&nbsp;
				            <input type="text" name="principalRealName" maxlength="50" value="${projectQueryDto.principalRealName}"  size="5"/>
				            &nbsp;测试负责人&nbsp;
				            <input type="text" name="testerRealName" maxlength="50" value="${projectQueryDto.testerRealName}"  size="5"/>
				             &nbsp;
						<select id="type" name="type">
							<ls:optionGroup type="select" required="false" cache="true" defaultDisp="-项目性质-" beanName="PROJECT_TYPE" selectedValue="${projectQueryDto.type}"/>
						</select>

						<select id="status" name="status">
								<ls:optionGroup type="select" required="false" cache="true" defaultDisp="-项目状态-" beanName="PROJECT_STATUS" selectedValue="${projectQueryDto.status}" exclude="4"/>
				             </select>
				            <input type="submit" value="搜索" class="criteria-btn"/>
				            <ls:auth ifAnyGranted="F_VIEW_ALL_DATA,F_NEW_PROJECT">
				            	<input type="button" value="创建" onclick='window.location="<ls:url address='/admin/project/load'/>"' class="criteria-btn"/>
				            </ls:auth>
				      </div>
		     </td></tr></tbody>
	    </table>
    </form>
    <div align="center">
          <%@ include file="/WEB-INF/pages/common/messages.jsp"%>
		<display:table name="list" requestURI="/admin/project/query" id="item" export="false" sort="external" class="${tableclass}" style="width:100%">
		    <display:setProperty name="basic.msg.empty_list_row"> 
	    		 找不到项目!
	        </display:setProperty>
	        <display:column title="ID" property="id" sortable="true" sortName="p1.id"></display:column>
     		<display:column title="项目名称" property="name" sortable="true" sortName="p1.name" style="min-width:150px"></display:column>
     		<display:column title="性质" sortable="true" sortName="p1.type" style="min-width:80px">
     		<!-- 0:普通项目,1:公共项目 -->
     			<c:if test="${item.type eq 0 }">私有</c:if>
				<c:if test="${item.type eq 1 }"><font color="#dc143c">公开</font></c:if>
     		</display:column>
     		<display:column title="项目经理" property="principalRealName" sortable="true" sortName="p1.principalRealName" style="min-width:80px"></display:column>
     		<display:column title="测试经理" property="testerRealName" sortable="true" sortName="p1.testerRealName" style="min-width:80px"></display:column>
     		<display:column title="开始时间" sortable="true" sortName="p1.start_time" style="min-width:80px"><fmt:formatDate value="${item.startTime }" pattern="yyyy-MM-dd"/></display:column>
     		<display:column title="结束时间" sortable="true" sortName="p1.end_time" style="min-width:80px">
				<c:choose>
					<c:when test="${item.endTime <= now}">
						<font color="red">
						<fmt:formatDate value="${item.endTime }" pattern="yyyy-MM-dd" />
						</font>
					</c:when>
					<c:otherwise>
						<fmt:formatDate value="${item.endTime }" pattern="yyyy-MM-dd" />

					</c:otherwise>
				</c:choose>

			</display:column>
     		<%--
     		<display:column title="可用工作日" property="workday" sortable="true" sortName="p1.workday"></display:column>
     		 --%>
     		<display:column title="预计人月(工时)"   sortable="true" sortName="p1.estimate_hours" style="min-width:80px">
	     		<c:if test="${item.estimateHours > 0}">
	     			<fmt:formatNumber pattern="#.##" value="${item.estimateHours / 8 /23}" />(${item.estimateHours})
	     		</c:if>
     			
     		</display:column>
     		<display:column title="实际人月(工时)"  sortable="true" sortName="p1.actual_hours" style="min-width:80px">
     		    <c:if test="${item.actualHours > 0}">
     		       <fmt:formatNumber pattern="#.##" value="${item.actualHours / 8 /23}" />( ${item.actualHours})
     		    </c:if>
     			
     		</display:column>
     		<display:column title="状态" sortable="true" sortName="p1.status" style="min-width:60px">
     		     <ls:optionGroup type="label" required="true" cache="true"
	                beanName="PROJECT_STATUS" selectedValue="${item.status}"/>
     		
     		</display:column>
	      <display:column title="操作" media="html" style="width:320px;min-width:320px">
	      	<div class="am-btn-toolbar">
			  <div class="am-btn-group am-btn-group-xs">
				    <button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location='${contextPath}/admin/projectPlan/query/${item.id}'"><span class="am-icon-pencil-square-o"></span>里程碑</button>
					<button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location='${contextPath}/admin/task/query/${item.id}'"><span class="am-icon-pencil-square-o"></span>目标</button>
				   <button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="window.location='${contextPath}/admin/task/dashboard/${item.id}'"><span class="am-icon-pencil-square-o"></span>看板</button>
					<div class="am-dropdown" data-am-dropdown>
		                <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>
		                <ul class="am-dropdown-content">
						  <li><a href="${contextPath}/admin/project/load/${item.id}">详情</a></li>
						  <li><a href="${contextPath}/admin/projectPlan/query/${item.id}">里程碑</a></li>
						  <li><a href="${contextPath}/admin/task/query/${item.id}">目标</a></li>
		                  <li><a href="${contextPath}/admin/projectModule/query/${item.id}">模块</a></li>
		                  <li><a href="${contextPath}/admin/projectMember/query/${item.id}">团队</a></li>
		                  <li><a href="${contextPath}/admin/projectReport/query/${item.id}">报表</a></li>
						  <li><a href="${contextPath}/admin/task/dashboard/${item.id}">看板</a></li>
		                 </ul>
	                </div>
	                <ls:auth ifAllGranted="M_DELETE_PROJECT">
						<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="deleteById('${item.id}')" ><span class="am-icon-trash-o"></span> 删除</button>
					</ls:auth>
			  </div>
			</div>
	      </display:column>
	    </display:table>
        <ls:page pageSize="${pageSize }"  total="${total}" curPageNO="${curPageNO }"  type="default"/> 
    </div>
    <div style="margin: 15px;" align="left">
   		 <c:if test="${actualHours > 0}">
		  消耗的总工时&nbsp;<b>${actualHours }</b>&nbsp;小时，
		  消耗的总人天是&nbsp;<b><fmt:formatNumber value="${actualHours/8 }" pattern="#.##" maxFractionDigits="2" /></b>&nbsp;，
		  消耗的总人月是&nbsp;<b><fmt:formatNumber value="${actualHours/8/24 }" pattern="#.##" maxFractionDigits="2" /></b>&nbsp;<br/>
		</c:if>
		  预计总时间&nbsp;<b>${estimateHours }</b>&nbsp;小时， 
		  预计总人天是&nbsp;<b><fmt:formatNumber value="${estimateHours/8 }" pattern="#.##" maxFractionDigits="2" /></b>&nbsp;，
		  预计总人月是&nbsp;<b><fmt:formatNumber value="${estimateHours/8/24 }" pattern="#.##" maxFractionDigits="2" /></b>&nbsp;
	</div>
    
        <script language="JavaScript" type="text/javascript">
			<!--
			  function deleteById(id) {
			      if(confirm("  确定删除 ?")){
			            window.location = "<ls:url address='/admin/project/delete/" + id + "'/>";
			        }
			    }
			
			        function pager(curPageNO){
			            document.getElementById("curPageNO").value=curPageNO;
			            document.getElementById("form1").submit();
			        }
			//-->
		</script>


